﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;

using DotNetNuke;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Services.FileSystem;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Tabs;
using DotNetNuke.UI.Modules;
using DotNetNuke.UI.Skins;


using CharityGamesOnline.Modules.Game;

namespace CharityGamesOnline.Modules.Common
{
    public partial class Donation : SkinObjectBase//PortalModuleBase
    {
        private const string MyFileName = "Donation.ascx";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                GameEnrollmentController ctrlEnroll = new GameEnrollmentController();
                decimal totalAmount = ctrlEnroll.GetMoneyCount(base.PortalSettings.PortalId, 0);
                decimal unpaidAmount = ctrlEnroll.GetMoneyCount(base.PortalSettings.PortalId, 0, 0, 0, (int)GameEnrollmentInfo.STATUS.ENROLLED);
                decimal donateAmount = totalAmount - unpaidAmount;
                lbDonationCount.Text = string.Format(Localization.GetString("lbDonationCount", Localization.GetResourceFile(this, MyFileName)), donateAmount);
            }
        }
    }
}